import request from '@/utils/request'

// 查询投票项目列表
export function listVoteProject(query) {
  return request({
    url: '/vote/voteProject/list',
    method: 'get',
    params: query
  })
}

export function listVoteProject1(query) {
  return request({
    url: '/vote/voteProject/listVoteProject1/list1',
    method: 'get',
    params: query
  })
}

// 查询投票项目详细
export function getVoteProject(voteId) {
  return request({
    url: '/vote/voteProject/' + voteId,
    method: 'get'
  })
}

// 新增投票项目
export function addVoteProject(data) {
  return request({
    url: '/vote/voteProject',
    method: 'post',
    data: data
  })
}

// 修改投票项目
export function updateVoteProject(data) {
  return request({
    url: '/vote/voteProject',
    method: 'put',
    data: data
  })
}

// 删除投票项目
export function delVoteProject(voteId) {
  return request({
    url: '/vote/voteProject/' + voteId,
    method: 'delete'
  })
}

export function updateVoteStatistic(voteId) {
  return request({
    url: '/vote/voteProject/updateVoteStatistic/' + voteId,
    method: 'get'
  })
}

export function changeVoteStatus(voteId, voteSts) {
  const data = {
    voteId,
    voteSts
  }
  return request({
    url: '/vote/voteProject/changeVoteStatus',
    method: 'put',
    data: data
  })
}
